package io.renren.modules.substation.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.substation.entity.TTotalDayInfoEntity;
import io.renren.modules.substation.service.TTotalDayInfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 变量统计日表
 *
 * @author yzx
 * @email sunlightcs@gmail.com
 * @date 2020-08-04 16:23:34
 */
@RestController
@RequestMapping("substation/ttotaldayinfo")
public class TTotalDayInfoController {
    @Autowired
    private TTotalDayInfoService tTotalDayInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("substation:ttotaldayinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tTotalDayInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("substation:ttotaldayinfo:info")
    public R info(@PathVariable("id") Long id){
		TTotalDayInfoEntity tTotalDayInfo = tTotalDayInfoService.getById(id);

        return R.ok().put("tTotalDayInfo", tTotalDayInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("substation:ttotaldayinfo:save")
    public R save(@RequestBody TTotalDayInfoEntity tTotalDayInfo){
		tTotalDayInfoService.save(tTotalDayInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("substation:ttotaldayinfo:update")
    public R update(@RequestBody TTotalDayInfoEntity tTotalDayInfo){
		tTotalDayInfoService.updateById(tTotalDayInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("substation:ttotaldayinfo:delete")
    public R delete(@RequestBody Long[] ids){
		tTotalDayInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
